package com.exp.bookhouse.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.exp.bookhouse.swagger.IgnoreSwaggerParameter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

@ApiModel("角色实体类Role")
@TableName("tb_role")
public class Role implements Serializable {

    @ApiModelProperty(value = "角色id")
    @TableId(type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "角色名")
    private String roleName;    //角色名

    @ApiModelProperty(value = "角色描述")
    private String roleDesc;    //角色描述

    @ApiModelProperty(value = "角色拥有的资源权限列表")
    @IgnoreSwaggerParameter     //不递归展开
    @TableField(exist = false)
    private List<Permission> permissions;   //角色拥有的权限

    public Role() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getRoleDesc() {
        return roleDesc;
    }

    public void setRoleDesc(String roleDesc) {
        this.roleDesc = roleDesc;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    @Override
    public String toString() {
        return "Role{" +
                "id=" + id +
                ", roleName='" + roleName + '\'' +
                ", roleDesc='" + roleDesc + '\'' +
                ", permissions=" + permissions +
                '}';
    }
}
